package com.bootdo.coach.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bootdo.coach.dao.TabDeviceMapper;
import com.bootdo.coach.dao.ext.ExtTabDeviceMapper;
import com.bootdo.coach.domain.TabDevice;
import com.bootdo.coach.service.TabDeviceService;
import com.bootdo.coach.vo.TabDeviceVo;


@Service
public class TabDeviceServiceImpl implements TabDeviceService {
    @Autowired
    private TabDeviceMapper mapper;
    @Autowired
    private ExtTabDeviceMapper extMapper;
	
    @Override
	public TabDevice selectByPrimaryKey(Long id) {
		return mapper.selectByPrimaryKey(id);
	}
	
	@Override
	public int insertSelective(TabDevice record) {
		return mapper.insertSelective(record);
	}
	
	@Override
	public int deleteByPrimaryKey(Long id) {
		return mapper.deleteByPrimaryKey(id);
	}
	
	@Override
	public List<TabDevice> selectByDeviceName(String DeviceName) {
		return extMapper.selectByDeviceName(DeviceName);
	}
	
	@Override
	public int updateByPrimaryKeySelective(TabDevice record) {
		return mapper.updateByPrimaryKeySelective(record);
	}
	
	@Override
	public int count(Map<String, Object> params) {
		return extMapper.count(params);
	}

	@Override
	public List<TabDeviceVo> list(Map<String, Object> params) {
		return extMapper.list(params);
	}
	
	@Override
	public boolean exitDeviceName(Map<String, Object> params) {
		boolean exit;
        exit = count(params) > 0;
        return exit;
	}
	
	@Override
	public boolean exitSerialNumber(Map<String, Object> params) {
		boolean exit;
        exit = count(params) > 0;
        return exit;
	}
	
	@Override
	public boolean exitDeviceTypeId(Map<String, Object> params) {
		boolean exit;
        exit = count(params) > 0;
        return exit;
	}
	
	@Override
	public List<TabDevice> selectBySerialNumber(String serialNumber) {
		return extMapper.selectBySerialNumber(serialNumber);
	}
	
	@Override
	public void updateDeviceOnline() {
		
		extMapper.updateDeviceOnline();
	}
}
